package org.devocean.groupbuying.dao.impl;

import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.devocean.groupbuying.dao.RoleDAO;
import org.devocean.groupbuying.domain.Role;
import org.springframework.stereotype.Repository;

@Repository
public class RoleDAOImpl implements RoleDAO{
	
	@PersistenceContext
	private EntityManager em;
	public Role findAuthority(String authority) {
		final List<Role> roles = em.createQuery("select r from Role r where r.authority=?1 ",Role.class).setParameter(1, authority).getResultList();
		return  roles.get(0);
	}

}
